from typing import List


class Solution:
    def maxSubstringLength(self, s: str, k: int) -> bool:
        if k == 0:
            return True
        n = len(s)
        maps = {}
        for i, c in enumerate(s):
            if c in maps:
                maps[c][1] = i
            else:
                maps[c] = [i, i]

        for i, c in enumerate(s):
            flag = True
            while flag:
                flag = False
                for key in maps:
                    if maps[key][0] < i and maps[key][1] > i:
                        if maps[key][0] > maps[c][0]:
                            maps[key][0] = maps[c][0]
                            flag = True
                        if maps[key][1] < maps[c][1]:
                            maps[key][1] = maps[c][1]
                            flag = True

        all = set()
        for key in maps:
            if maps[key][0] == 0 and maps[key][1] == n - 1:
                all.add(key)

        for toremoved in all:
            maps.pop(toremoved)

        print(maps)

        seted_maps = set((c0, c1) for c0, c1 in maps.values())
        kk = len()

        kinds = kk

        if kinds < k:
            return False

        sorted_maps = sorted(list(seted_maps), key=lambda x: x[1])
        
        ans = 0
        pre_r = -0x3f3f3f3f
        for l, r in sorted_maps:
            if l >= pre_r:
                ans += 1
                pre_r = r

        return ans >= k
